<?php
session_start(); 
//error_reporting(7);
require_once '../../includes/global.php';

//得到配置文件
$wcfg=Dga('wcfg',"web like '".$sitename."' and lg like '".$_SESSION[LG]."'");
$wcfg=json_decode($wcfg[wcfg],true);
$dcfg=Dga('dcfg',"id like '".$_GET[did]."'");
$dcfg=json_decode($dcfg[dcfg],true);
//Jc($wcfg);
//检测多语言屏蔽
if(array_key_exists($dcfg['name'],$wcfg['ping'])){
	$wcfg['num']=1;
	$temp=$wcfg['lang'][$wcfg['ping'][$dcfg['name']]];
	unset($wcfg['lang']);
	$wcfg['lang'][$wcfg['ping'][$dcfg['name']]]=$temp;
}
//Jc($wcfg);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prosperous JIMU</title>
<link  href="../css/mod.css"  rel="stylesheet" type="text/css" />
<script language="javascript">
function switchTag(tag,content){
var allnum=<?php echo $wcfg[num];?>;
	for(i=1; i <=allnum+1; i++)
	{
		if ("tag"+i==tag)
		{
			document.getElementById(tag).getElementsByTagName("a")[0].className="selectli"+i;
			document.getElementById(tag).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="selectspan"+i;
		}else{
			document.getElementById("tag"+i).getElementsByTagName("a")[0].className="";
			document.getElementById("tag"+i).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="";
		}
		if ("content"+i==content)
		{
			document.getElementById(content).className="";
		}else{
			document.getElementById("content"+i).className="hidecontent";
		}
		document.getElementById("content").className=content;
	}
}
</script>
<?php 
//加载表单验证
$validation=array('18'=>2);
if($validation[$_GET[did]]!=''){
jsform($jsform,$validation[$_GET[did]]);
}else{
jsform($jsform);
}
echo $jsform;
?>
</head>
<body>

<form action="u.php" method="post" enctype="multipart/form-data" onsubmit="return false" id="vform">
<div id="container">
<div id="title">
    <ul>
<?php $i=1;
	    foreach($wcfg[lang] as $key =>$lg){
		         if($i==1){
				 $temp1="class=\"selectli".$i."\"";
				 $temp2="class=\"selectspan".$i."\"";
				 }else{
				 $temp1="";
				 $temp2="";
				 }
				
		echo "<li id=\"tag".$i."\"><a href=\"#\" onclick=\"switchTag('tag".$i."','content".$i."');this.blur();\" ".$temp1."><span ".$temp2.">".$dcfg['title']."【".$lg."】</span></a></li>";
		$i++;
		}
?>
    </ul>
  </div>
  <div id="content" class="content1">
<?php

if($_GET['gid']!=''){
$nowinfo=Dgs($dcfg[name],"gid='".$_GET['gid']."'");
}//gid
$_GET['gid']==''&&$_GET['gid']=Mct();
//内容重现
//echo $_GET['gid'];
if(Jp($nowinfo)){
	foreach($nowinfo as $key =>$tinfo){
	$info[$tinfo[lg]]=$tinfo;
		Jp($tinfo[bdid])&&$_GET[bdid]=$ttinfo[bdid];
		Jp($tinfo[bdsortid])&&$_GET[bdsortid]=$ttinfo[bdsortid];
	} 
}
//---
$xhgs=1;
 foreach($wcfg[lang] as $lgk =>$lgv){
		 if($xhgs==1){
		 echo " <div id=\"content".$xhgs."\" >";
				 }else{
				 echo "<div id=\"content".$xhgs."\" class=\"hidecontent\">";
				 }
				echo "<a href='l.php?did=".$_GET['did'].(($_GET['bdb'])?("&bdb=".$_GET['bdb']."&bdid=".$_GET['bdid'].""):(""))."' title='列表【LIST】'><img src='../img/table.gif' border='0' ait='列表【LIST】'></a>    <a href='#' onclick=\"location.reload();\" title='刷新【REFRESH】'><img src='../img/page_refresh.gif' border='0' ait='刷新【REFRESH】'></a>  <a href='javascript:history.go(-1)'  title='后退【BACK】'><img src='../img/arrow_rotate_anticlockwise.png' border='0' ait='后退【BACK】'></a>";
		echo "<fieldset><legend>".$lgk."[".$lgv."]=>".$dcfg[title]."</legend>";
		//内容开始
		?>
      <table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#B1CDE6"  style="border-collapse: collapse">
		
		<?php
		foreach($dcfg[structure] as $dkey =>$dvalue){
			switch ($dvalue[ftype]){
				case 'text':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php text($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					text($dkey,$lgk,1,0,$info[$lgk][$dkey]);
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'md5str':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php md5str($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					md5str($dkey,$lgk,1,0,$info[$lgk][$dkey]);
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'phpfile':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php phpfile($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					phpfile($dkey,$lgk,1,0,$_GET['gid']);
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'fileup':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php fileup($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					fileup($dkey,$lgk,1,0,$info[$lgk][$dkey]);
					
				?></td>
              </tr>   
                 <?php
				 break;
				}
			
				case 'hide':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php hide($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					hide($dkey,$lgk,1,0,$info[$lgk][$dkey]);
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'select':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php select($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					if($info[$lgk][$dkey]){
					$info[$lgk][$dkey]=explode(',',$info[$lgk][$dkey]);
					}
					select($dkey,$lgk,1,0,$info[$lgk][$dkey]);
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'checkbox':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php checkbox($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					if($info[$lgk][$dkey]){
					$info[$lgk][$dkey]=explode(',',$info[$lgk][$dkey]);
					}
					checkbox($dkey,$lgk,1,0,$info[$lgk][$dkey]);
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'radio':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php radio($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					radio($dkey,$lgk,1,0,$info[$lgk][$dkey]);
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'textarea':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php textarea($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					textarea($dkey,$lgk,1,0,$info[$lgk][$dkey]);
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'ubb':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php ubb($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					ubb($dkey,$lgk,1,0,$info[$lgk][$dkey]);
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'bind':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php echo  $dvalue['COMMENT']?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
					echo "<a href='c.php?did=".$dvalue['did']."&bdb=".$_GET['did']."&bdid=".$_GET['gid']."&comment=".urlencode($dvalue['COMMENT'])."' title='添加".$dvalue['COMMENT']."【AddBind】'><img src='../img/image_new.gif' border='0' ait='添加".$dvalue['COMMENT']."【AddBind】'></a> <a href='l.php?did=".$dvalue['did']."&bdb=".$_GET['did']."&bdid=".$_GET['gid']."&comment=".urlencode($dvalue['COMMENT'])."' title='列表".$dvalue['COMMENT']."【Listbind】'><img src='../img/image.gif' border='0' ait='列表".$dvalue['COMMENT']."【Listbind】'></a>  ";
				?></td>
              </tr>   
                 <?php
				 break;
				}
				case 'dselect':{
				?>
				<tr> 
            <td height="30" width="19%" align="right" class="title"><?php dselect($dkey,$lgk,0,0);?>：</td>
            <td width="81%" height="30" align="left" class=con>  
				<?php
				//Ja($info[$lgk][$dkey]);
					if($_GET['dsid']!=''){
					dselect($dkey,$lgk,1,0,$_GET['dsid']);
					}else{
					dselect($dkey,$lgk,1,0,$info[$lgk][$dkey]);
					}
				?></td>
              </tr>   
                 <?php
				 break;
				}
			}	
		}
		
		?>
		
		</table></fieldset>
		<?php
		$xhgs++;
		echo "</div>";
		}
	?>
        </div>
    <div  align="center"><BR />
     <input type="submit" value="提交" /></div><br />
     <input name="op" type="hidden"  value="<?php echo $_REQUEST[op];?>"   />  
     <input name="did" type="hidden"  value="<?php echo $_REQUEST[did];?>"   />  
	       
</form>


</body>
</html>
